package com.miyake.rest;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import org.simpleframework.xml.Element;
import org.simpleframework.xml.ElementList;
import org.simpleframework.xml.Root;

@Root
public class WebServiceProperty {
    @Element
    private String serviceName = "Your Service Name";
    @Element
    private String provider = "Your Company Name";
    @Element
    private String version = "Version";
    @Element
    private String description = "Description";
    @Element
    private String serviceUrl = "http://yourweb.com";
    @Element
    private String companyUrl = "http://yourcompany.com";
    @Element
    private String category = "Other";
    @Element
    private ServiceType serviceType = ServiceType.FileParser;
    @ElementList
    private List<Value> values = new ArrayList<Value>();
    @ElementList
    private List<DataColumn> data = new ArrayList<DataColumn>();
    @Element
    private LicenseType licenseType = LicenseType.Free;
    @ElementList
    private List<String> relatedServices = new ArrayList<String>();
    /**
     * @return the serviceName
     */
    public String getServiceName() {
        return serviceName;
    }

    /**
     * @param serviceName the serviceName to set
     */
    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    /**
     * @return the provider
     */
    public String getProvider() {
        return provider;
    }

    /**
     * @param provider the provider to set
     */
    public void setProvider(String provider) {
        this.provider = provider;
    }

    /**
     * @return the version
     */
    public String getVersion() {
        return version;
    }

    /**
     * @param version the version to set
     */
    public void setVersion(String version) {
        this.version = version;
    }

    /**
     * @return the serviceType
     */
    public ServiceType getServiceType() {
        return serviceType;
    }

    /**
     * @param serviceType the serviceType to set
     */
    public void setServiceType(ServiceType serviceType) {
        this.serviceType = serviceType;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @return the serviceUrl
     */
    public String getServiceUrl() {
        return serviceUrl;
    }

    /**
     * @param serviceUrl the serviceUrl to set
     */
    public void setServiceUrl(String serviceUrl) {
        this.serviceUrl = serviceUrl;
    }

    /**
     * @return the companyUrl
     */
    public String getCompanyUrl() {
        return companyUrl;
    }

    /**
     * @param companyUrl the companyUrl to set
     */
    public void setCompanyUrl(String companyUrl) {
        this.companyUrl = companyUrl;
    }

    /**
     * @return the values
     */
    public List<Value> getValues() {
        return values;
    }

    /**
     * @param values the values to set
     */
    public void setValues(List<Value> values) {
        this.values = values;
    }

    /**
     * @return the data
     */
    public List<DataColumn> getData() {
        return data;
    }

    /**
     * @param data the data to set
     */
    public void setData(List<DataColumn> data) {
        this.data = data;
    }

    /**
     * @return the licenseType
     */
    public LicenseType getLicenseType() {
        return licenseType;
    }

    /**
     * @param licenseType the licenseType to set
     */
    public void setLicenseType(LicenseType licenseType) {
        this.licenseType = licenseType;
    }

    /**
     * @return the category
     */
    public String getCategory() {
        return category;
    }

    /**
     * @param category the category to set
     */
    public void setCategory(String category) {
        this.category = category;
    }

    public static WebServiceProperty fromXml(InputStream stream) {
        return XmlSerializer.deserialize(stream, WebServiceProperty.class);
    }

    public static WebServiceProperty fromXml(String xml) {
        return XmlSerializer.deserialize(xml, WebServiceProperty.class);
    }
    
    public String toXML() {
        return XmlSerializer.serialize(this);
    }

    /**
     * @return the relatedServices
     */
    public List<String> getRelatedServices() {
        return relatedServices;
    }

    /**
     * @param relatedServices the relatedServices to set
     */
    public void setRelatedServices(List<String> relatedServices) {
        this.relatedServices = relatedServices;
    }
}
